#include "mylistwidget.h"

MyListWidget::MyListWidget(QWidget *parent) :
    QListWidget(parent)
{
    setDragEnabled(true);
    setAcceptDrops(false);
    setDragDropMode(QAbstractItemView::DragOnly);
    setViewMode(QListView::ListMode);
    setIconSize(QSize(ICON_HEIGHT, ICON_WIDTH));
}

 QMimeData* MyListWidget::mimeData(const QList<QListWidgetItem *> items) const
 {
     MyListWidgetItem *item = (MyListWidgetItem*)items.at(0);
     QColor color = item->color();
     QMimeData *mime = QListWidget::mimeData(items);
     mime->setData("new", QByteArray().append(item->toolTip()));
     mime->setData(QString("color"), QByteArray().append(QString("#%1%2%3")
                                                        .arg(color.red(), 2, 16, QLatin1Char('0'))
                                                        .arg(color.green(), 2, 16, QLatin1Char('0'))
                                                        .arg(color.blue(), 2, 16, QLatin1Char('0'))));
     mime->setData(QString("type"), QByteArray().append(item->typeMy()));
     mime->setText(QString("myItem"));

     return mime;
 }
